package com.equipment.training.web.api;

import com.baomidou.mybatisplus.plugins.Page;
import com.equipment.training.entity.AcupointTraining;
import com.equipment.training.service.AcupointTrainingService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * ${DESCRIPTION}
 *
 * @author 杨凯
 * @create 2018-04-11 14:55
 **/
@RestController
@RequestMapping("/training")
public class TrainingController {


	@Autowired
	private AcupointTrainingService acupointTrainingService;


	@GetMapping("/list")
	public Map<String, Object> acupointTrainingList(@RequestParam(defaultValue = "0") int start, @RequestParam(defaultValue = "10") int length) {
		Map<String, Object> map = new HashMap<>(3);
		Page page = new Page(start, length);
		Page<AcupointTraining> userPage = acupointTrainingService.selectPage(page);
		List<AcupointTraining> list = userPage.getRecords();
		map.put("data", list);
		map.put("count", userPage.getTotal());
		return map;
	}



}
